﻿using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonDemo.Core.Entities;
public class Demo:Entity<string>, IEntityTypeBuilder<Demo>
{
    public string Name { get; set; }
    public List<Tag> Tags { get; set; } = new();

    public List<string> Markers { get; set; } = new();  

    public void Configure(EntityTypeBuilder<Demo> entityBuilder, DbContext dbContext, Type dbContextLocator)
    {
        entityBuilder.OwnsMany(x => x.Tags, e =>
        {
            e.ToJson();
        });

        entityBuilder.OwnsMany(x => x.Markers, e =>
        {
            e.ToJson();
        });
    }
}
